<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 200px;
            border: 5px red dashed;
            padding: 20px;
            /* background-image: url(../../客户端/img/dog.jpg);
            background-clip: content-box; */
        }

        button {
            background-color: rgb(94, 131, 166);
            color: white;
            border: none;
            border-radius: 8px;

        }
    </style>
</head>

<body>
    <div></div>

    <button id="btn">切换颜色</button>

    <script src="../../JS基础/utils.js"></script>
    <script>
        let btn = document.getElementById('btn');
        let div = document.querySelector('div');
        btn.onclick = function () {

            // div.style.backgroundColor=`rgb(${createRandom(0,255)},${createRandom(0,255)},${createRandom(0,255)})`

            div.style.cssText = `
            background-color: rgb(${createRandom(0, 255)},${createRandom(0, 255)},${createRandom(0, 255)});
            `
            console.log(window.getComputedStyle(div).backgroundColor);
            console.log(window.getComputedStyle(div).height);
        }

        //----- 获取元素最终的样式


    </script>

</body>

</html>